import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

let defaultCity
try{
  defaultCity= localStorage.city || '上海'
}catch(e){
  console.log('没有存储cookie，检测浏览器是否关闭存储')
}

export default new Vuex.Store({
  state: {
    city:defaultCity
  },
  mutations: {
    selectCity(state,city){
      state.city= city
      try{
        localStorage.city= city
      }catch(e){
        console.log('没有存储cookie，检测浏览器是否关闭存储')
      }
    }
  },
  actions: {
  },
  modules: {
  }
})
